package com.njtoyo.taxi.admin.mapper.master.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;

import java.util.Arrays;

public enum CouponScope {
    mix(0, "mix"),
    realtime(1, "realtime"),
    appointment(2, "appointment");

    @EnumValue
    private final int code;
    private final String desc;

    CouponScope(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public static CouponScope getByCode(int code) {
        return Arrays.stream(CouponScope.values()).filter(e -> e.getCode() == code).findFirst().get();
    }
}
